﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace HRM.Data
{
    public class Encryption
    {
        public static string Encrypt(string password)
        {
            byte[] bytes = Encoding.Unicode.GetBytes(password);
            var csp = new MD5CryptoServiceProvider();
            byte[] byteHash = csp.ComputeHash(bytes);
            string hash = string.Empty;
            foreach (var _byte in byteHash)
                hash += string.Format("{0:x2}", _byte);
            return hash;
        }
    }
}
